Quick Links
Example Catalog
Take a look at these examples to see the various applications of Traversecraft!
-
Question: Given an m x n 2D binary grid representing a map of '1's (land) and '0's (water), return the number of islands. An island is a region of connected land ('1's) surrounded by water ('0's) and formed by connecting adjacent lands horizontally or vertically. You may assume that all four edges of the grid are surrounded by water.
Simulation:
Find the source code here at Number of Islands!
-
Question: There is a robot on an m x n grid, initially located at the top-left corner (grid[0][0]). The robot aims to move to the bottom-right corner (grid[m-1][n-1]) and can only move either down or right at any time. Given two integers m and n, return the number of unique paths the robot can take to reach the bottom-right corner.
Simulation:
Find the source code here at Unique Paths!
-
Question: You are given an m x n integer array grid. A robot is initially located at the top-left corner (grid[0][0]) and aims to move to the bottom-right corner (grid[m-1][n-1]). The robot can only move either down or right at any time. In the grid, obstacles are marked as 1 and free spaces as 0. The robot's path cannot include any square that contains an obstacle. Return the number of unique paths the robot can take to reach the bottom-right corner.
Simulation:
Find the source code here at Unique Paths with Obstacles!
-
Question: Traverse a binary tree in a level order fashion (i.e., from left to right, level by level).
Simulation:
Find the source code here at Level Order Traversal!
-
Question: Find the lowest common ancestor of two given nodes in a binary tree. The lowest common ancestor (LCA) of two nodes p and q in a binary tree is the lowest node that has both p and q as descendants.
Simulation:
Find the source code here at Lowest Common Ancestor!
-
Question: Perform A* search in a grid to find the shortest path from the start node to the end node.
Simulation:
Find the source code here at A* Algorithm!
-
Question: Find the shortest path from the start node to the end node in a graph using Dijkstra's algorithm.
Simulation:
Find the source code here at Dijkstra Algorithm!